import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.ArrayList;


public class PlatformMove extends Platform {
	int[] pointx;
	int[] pointy;
	int[] coords;
	int placex=2;
	int placey=3;
	double d;
	double tempx;
	double tempy;
	
	public PlatformMove(int[]coor ) {

		super(coor[0],coor[1],160,40);

		if(coor[4]==1){
			w=40;
			h=160;
		}
		coords=coor;

	}

	@Override
	public void drawSelf(Graphics g) {
		Graphics2D g2= (Graphics2D)g;
		g2.setColor(Color.blue);
		g2.fillRect(x, y, w, h);
	}

	public void move(){
		tempx=	coords[placex];
		tempy=	coords[placey];
		if(x<tempx){
			x++;	
			if(x>tempx)
				if(placex==2){
					placex=0;
				}
				else{
					placex=2;
				}
		}
		else if(x>tempx){
			x--;
			if(x<tempx)
				if(placex==0){
					placex=2;
				}
				else{
					placex=0;
				}
		}
		if(y<tempy){
			y++;
			if(y>tempy)
				if(placey==3){
					placey=1;
				}
				else{
					placey=3;
				}
		}
		else if(y>tempy){
			y--;
			if(y<tempy)
				if(placey==1){
					placey=3;
				}
				else{
					placey=1;
				}
		}

	}
}


